home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet multimedia
/
Muzyka
/
Edytory sampli (probek dzwieku)
/
ZynAddSubFX_2.2.0
/
Setup_ZynAddSubFX-2.2.0.exe
/
source code
/
UI
/
EnvelopeUI.fl
< prev
next >
Wrap
Text File
|
2005-03-14
|
26KB
|
852 lines
# data file for the Fltk User Interface Designer (fluid)
version 1.0106
header_name {.h}
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
decl {//License: GNU GPL version 2} {}
decl {\#include "WidgetPDial.h"} {public
}
decl {\#include <stdio.h>} {public
}
decl {\#include <stdlib.h>} {public
}
decl {\#include "../globals.h"} {public
}
decl {\#include <FL/Fl_Group.H>} {public
}
decl {\#include "../Params/EnvelopeParams.h"} {public
}
decl {\#include <FL/Fl_Box.H>} {public
}
decl {\#include <FL/fl_draw.H>} {public
}
decl {\#include <FL/fl_ask.H>} {public
}
decl {\#include "PresetsUI.h"} {public
}
class EnvelopeFreeEdit {: {public Fl_Box}
} {
Function {EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
code {env=NULL;
pair=NULL;} {}
}
Function {init(EnvelopeParams *env_)} {} {
code {env=env_;
oldx=-1;
currentpoint=-1;
cpx=0;
lastpoint=-1;} {}
}
Function {setpair(Fl_Box *pair_)} {} {
code {pair=pair_;} {}
}
Function {getpointx(int n)} {return_type int
} {
code {int lx=w()-10;
int npoints=env->Penvpoints;
float sum=0;
for (int i=1;i<npoints;i++) sum+=env->getdt(i)+1;
float sumbefore=0;//the sum of all points before the computed point
for (int i=1;i<=n;i++) sumbefore+=env->getdt(i)+1;
return((int) (sumbefore/(REALTYPE) sum*lx));} {}
}
Function {getpointy(int n)} {return_type int
} {
code {int ly=h()-10;
return((int) ((1.0-env->Penvval[n]/127.0)*ly));} {}
}
Function {getnearest(int x,int y)} {return_type int
} {
code {x-=5;y-=5;
int nearestpoint=0;
int nearestval=1000000;//a big value
for (int i=0;i<env->Penvpoints;i++){
int distance=abs(x-getpointx(i))+abs(y-getpointy(i));
if (distance<nearestval) {
nearestpoint=i;
nearestval=distance;
};
};
return(nearestpoint);} {}
}
Function {draw()} {private
} {
code {int ox=x(),oy=y(),lx=w(),ly=h();
if (env->Pfreemode==0) env->converttofree();
int npoints=env->Penvpoints;
if (active_r()) fl_color(FL_BLACK);
else fl_color(90,90,90);
if (!active_r()) currentpoint=-1;
fl_rectf(ox,oy,lx,ly);
ox+=5;oy+=5;lx-=10;ly-=10;
//draw the lines
fl_color(FL_GRAY);
fl_line_style(FL_SOLID);
fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2);
//draws the evelope points and lines
Fl_Color alb=FL_WHITE;
if (!active_r()) alb=fl_rgb_color(180,180,180);
fl_color(alb);
int oldxx=0,xx=0,oldyy=0,yy=getpointy(0);
fl_rectf(ox-3,oy+yy-3,6,6);
for (int i=1;i<npoints;i++){
oldxx=xx;oldyy=yy;
xx=getpointx(i);yy=getpointy(i);
if (i==currentpoint) fl_color(FL_RED);
else fl_color(alb);
fl_line(ox+oldxx,oy+oldyy,ox+xx,oy+yy);
fl_rectf(ox+xx-3,oy+yy-3,6,6);
};
//draw the last moved point point (if exists)
if (lastpoint>=0){
fl_color(FL_CYAN);
fl_rectf(ox+getpointx(lastpoint)-5,oy+getpointy(lastpoint)-5,10,10);
};
//draw the sustain position
if (env->Penvsustain>0){
fl_color(FL_YELLOW);
xx=getpointx(env->Penvsustain);
fl_line(ox+xx,oy+0,ox+xx,oy+ly);
};
//Show the envelope duration and the current line duration
fl_font(FL_HELVETICA|FL_BOLD,10);
float time=0.0;
if (currentpoint<=0){
fl_color(alb);
for (int i=1;i<npoints;i++) time+=env->getdt(i);
} else {
fl_color(255,0,0);
time=env->getdt(currentpoint);
};
char tmpstr[20];
if (time<1000.0) snprintf((char *)&tmpstr,20,"%.1fms",time);
else snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0);
fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0);} {}
}
Function {handle(int event)} {return_type int
} {
code {int x_=Fl::event_x()-x();
int y_=Fl::event_y()-y();
if (event==FL_PUSH) {
currentpoint=getnearest(x_,y_);
cpx=x_;
cpdt=env->Penvdt[currentpoint];
lastpoint=currentpoint;
redraw();
if (pair!=NULL) pair->redraw();
};
if (event==FL_RELEASE){
currentpoint=-1;
redraw();
if (pair!=NULL) pair->redraw();
};
if ((event==FL_DRAG)&&(currentpoint>=0)){
int ny=127-(int) (y_*127.0/h());
if (ny<0) ny=0;if (ny>127) ny=127;
env->Penvval[currentpoint]=ny;
int dx=(int)((x_-cpx)*0.1);
int newdt=cpdt+dx;
if (newdt<0) newdt=0;if (newdt>127) newdt=127;
if (currentpoint!=0) env->Penvdt[currentpoint]=newdt;
else env->Penvdt[currentpoint]=0;
redraw();
if (pair!=NULL) pair->redraw();
};
return(1);} {}
}
decl {Fl_Box *pair;} {}
decl {EnvelopeParams *env;} {}
decl {int oldx,oldy;} {}
decl {int currentpoint,cpx,cpdt;} {}
decl {int lastpoint;} {public
}
}
class EnvelopeUI {: {public Fl_Group,PresetsUI_}
} {
Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
code {env=NULL;
freemodeeditwindow=NULL;
envADSR=NULL;
envASR=NULL;
envADSRfilter=NULL;
envASRbw=NULL;
envfree=NULL;} {}
}
Function {~EnvelopeUI()} {} {
code {envwindow->hide();
hide();
freemodeeditwindow->hide();
delete (freemodeeditwindow);} {}
}
Function {make_freemode_edit_window()} {} {
Fl_Window freemodeeditwindow {
label Envelope
xywh {60 308 575 180} type Double hide
} {
Fl_Box freeedit {
label Envelope
xywh {5 5 565 145} box FLAT_BOX color 0
code0 {o->init(env);}
class EnvelopeFreeEdit
}
Fl_Button addpoint {
label {Add point}
callback {int curpoint=freeedit->lastpoint;
if (curpoint<0) return;
//if (curpoint>=env->Penvpoints-1) return;
if (env->Penvpoints>=MAX_ENVELOPE_POINTS) return;
for (int i=env->Penvpoints;i>=curpoint+1;i--){
env->Penvdt[i]=env->Penvdt[i-1];
env->Penvval[i]=env->Penvval[i-1];
};
if (curpoint==0) {
env->Penvdt[1]=64;
};
env->Penvpoints++;
if (curpoint<=env->Penvsustain) env->Penvsustain++;
freeedit->lastpoint+=1;
freeedit->redraw();
envfree->redraw();
sustaincounter->value(env->Penvsustain);
sustaincounter->maximum(env->Penvpoints-2);}
xywh {115 155 80 20} box THIN_UP_BOX
code0 {if (env->Pfreemode==0) o->hide();}
}
Fl_Button deletepoint {
label {Delete point}
callback {int curpoint=freeedit->lastpoint;
if (curpoint<1) return;
if (curpoint>=env->Penvpoints-1) return;
if (env->Penvpoints<=3) return;
for (int i=curpoint+1;i<env->Penvpoints;i++){
env->Penvdt[i-1]=env->Penvdt[i];
env->Penvval[i-1]=env->Penvval[i];
};
env->Penvpoints--;
if (curpoint<=env->Penvsustain) env->Penvsustain--;
freeedit->lastpoint-=1;
freeedit->redraw();
envfree->redraw();
sustaincounter->value(env->Penvsustain);
sustaincounter->maximum(env->Penvpoints-2);}
xywh {200 155 80 20} box THIN_UP_BOX
code0 {if (env->Pfreemode==0) o->hide();}
}
Fl_Light_Button freemodebutton {
label FreeMode
callback {reinit();
freeedit->lastpoint=-1;
freeedit->redraw();}
tooltip {Enable or disable the freemode} xywh {10 155 95 25} box PLASTIC_UP_BOX
}
Fl_Check_Button forcedreleasecheck {
label frcR
callback {env->Pforcedrelease=(int)o->value();}
tooltip {Forced Relase} xywh {410 165 40 15} down_box DOWN_BOX labelsize 11
code0 {o->value(env->Pforcedrelease);}
code1 {if (env->Pfreemode==0) o->hide();}
}
Fl_Dial envstretchdial {
label {Str.}
callback {env->Penvstretch=(int)o->value();}
tooltip {Envelope stretch (on lower notes make the envelope longer)} xywh {380 155 25 25} box ROUND_UP_BOX labelsize 11 align 4 maximum 127 step 1
code0 {o->value(env->Penvstretch);}
code1 {if (env->Pfreemode==0) o->hide();}
class WidgetPDial
}
Fl_Button {} {
label Close
callback {freemodeeditwindow->hide();}
xywh {510 155 60 25} box THIN_UP_BOX
}
Fl_Check_Button linearenvelopecheck {
label L
callback {env->Plinearenvelope=(int)o->value();}
tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 11
code0 {o->value(env->Plinearenvelope);}
code1 {if ((env->Pfreemode==0)||(env->Envmode>2)) o->hide();}
}
Fl_Counter sustaincounter {
label Sust
callback {env->Penvsustain=(int) o->value();
freeedit->redraw();
envfree->redraw();}
tooltip {Sustain (0 is disabled)} xywh {315 155 40 15} type Simple labelsize 12 align 4 minimum 0 maximum 127 step 1
code0 {o->value(env->Penvsustain);}
code1 {if (env->Pfreemode==0) o->hide();}
code2 {o->maximum(env->Penvpoints-2);}
}
Fl_Button {} {
label C
callback {presetsui->copy(env);}
xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(env,this);}
xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
}
}
Function {make_ADSR_window()} {} {
Fl_Window envADSR {
xywh {108 336 205 70} type Double color 50 labelfont 1 hide
class Fl_Group
} {
Fl_Group {} {
label {Amplitude Envelope}
xywh {0 0 205 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 11 align 17
} {
Fl_Dial e1adt {
label {A.dt}
callback {env->PA_dt=(int)o->value();
freeedit->redraw();}
tooltip {Attack time} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_dt);}
class WidgetPDial
}
Fl_Dial e1ddt {
label {D.dt}
callback {env->PD_dt=(int)o->value();
freeedit->redraw();}
tooltip {Decay time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PD_dt);}
class WidgetPDial
}
Fl_Dial e1rdt {
label {R.dt}
callback {env->PR_dt=(int)o->value();
freeedit->redraw();}
tooltip {Release time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_dt);}
class WidgetPDial
}
Fl_Dial e1sval {
label {S.val}
callback {env->PS_val=(int)o->value();
freeedit->redraw();}
tooltip {Sustain value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PS_val);}
class WidgetPDial
}
Fl_Check_Button e1forcedrelease {
label frcR
callback {env->Pforcedrelease=(int)o->value();}
tooltip {Forced Relase} xywh {180 35 20 15} down_box DOWN_BOX labelsize 11 align 6
code0 {o->value(env->Pforcedrelease);}
}
Fl_Dial e1envstretch {
label Stretch
callback {env->Penvstretch=(int)o->value();}
tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->Penvstretch);}
class WidgetPDial
}
Fl_Button {} {
label E
callback {freemodeeditwindow->show();}
tooltip {Envelope window} xywh {185 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10
}
Fl_Check_Button e1linearenvelope {
label L
callback {env->Plinearenvelope=(int)o->value();}
tooltip {The evelope is linear} xywh {180 20 15 15} down_box DOWN_BOX labelsize 11 align 4
code0 {o->value(env->Plinearenvelope);}
}
Fl_Button {} {
label C
callback {presetsui->copy(env);}
xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(env,this);}
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
}
}
}
Function {make_ASR_window()} {} {
Fl_Window envASR {
xywh {71 320 210 70} type Double hide
class Fl_Group
} {
Fl_Group {} {
label {Frequency Envelope}
xywh {0 0 210 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 11 align 17
} {
Fl_Dial e2aval {
label {A.val}
callback {env->PA_val=(int)o->value();
freeedit->redraw();}
tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_val);}
class WidgetPDial
}
Fl_Dial e2adt {
label {A.dt}
callback {env->PA_dt=(int)o->value();
freeedit->redraw();}
tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_dt);}
class WidgetPDial
}
Fl_Dial e2rval {
label {R.val}
callback {env->PR_val=(int)o->value();
freeedit->redraw();}
tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_val);}
class WidgetPDial
}
Fl_Dial e2rdt {
label {R.dt}
callback {env->PR_dt=(int)o->value();
freeedit->redraw();}
tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_dt);}
class WidgetPDial
}
Fl_Dial e2envstretch {
label Stretch
callback {env->Penvstretch=(int)o->value();}
tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->Penvstretch);}
class WidgetPDial
}
Fl_Check_Button e2forcedrelease {
label frcR
callback {env->Pforcedrelease=(int)o->value();}
tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 11 align 6
code0 {o->value(env->Pforcedrelease);}
}
Fl_Button {} {
label C
callback {presetsui->copy(env);}
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(env,this);}
xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
}
Fl_Button {} {
label E
callback {freemodeeditwindow->show();}
tooltip {Envelope window} xywh {190 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10
}
}
}
Function {make_ADSRfilter_window()} {} {
Fl_Window envADSRfilter {
xywh {87 143 275 70} type Double color 50 labelfont 1 hide
class Fl_Group
} {
Fl_Group {} {
label {Filter Envelope}
xywh {0 0 275 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 11 align 17
} {
Fl_Dial e3aval {
label {A.val}
callback {env->PA_val=(int)o->value();
freeedit->redraw();}
tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_val);}
class WidgetPDial
}
Fl_Dial e3adt {
label {A.dt}
callback {env->PA_dt=(int)o->value();
freeedit->redraw();}
tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_dt);}
class WidgetPDial
}
Fl_Dial e3dval {
label {D.val}
callback {env->PD_val=(int)o->value();
freeedit->redraw();}
tooltip {decay value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PD_val);}
class WidgetPDial
}
Fl_Dial e3ddt {
label {D.dt}
callback {env->PD_dt=(int)o->value();
freeedit->redraw();}
tooltip {decay time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PD_dt);}
class WidgetPDial
}
Fl_Dial e3rdt {
label {R.dt}
callback {env->PR_dt=(int)o->value();
freeedit->redraw();}
tooltip {Release time} xywh {145 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_dt);}
class WidgetPDial
}
Fl_Dial e3rval {
label {R.val}
callback {env->PR_val=(int)o->value();
freeedit->redraw();}
tooltip {Release value} xywh {180 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_val);}
class WidgetPDial
}
Fl_Dial e3envstretch {
label Stretch
callback {env->Penvstretch=(int)o->value();}
tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {215 25 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->Penvstretch);}
class WidgetPDial
}
Fl_Check_Button e3forcedrelease {
label frcR
callback {env->Pforcedrelease=(int)o->value();}
tooltip {Forced Relase} xywh {250 30 15 20} down_box DOWN_BOX labelsize 11 align 6
code0 {o->value(env->Pforcedrelease);}
}
Fl_Button {} {
label E
callback {freemodeeditwindow->show();}
xywh {255 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10
}
Fl_Button {} {
label C
callback {presetsui->copy(env);}
xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(env,this);}
xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
}
}
}
Function {make_ASRbw_window()} {} {
Fl_Window envASRbw {
xywh {224 539 210 70} type Double hide
class Fl_Group
} {
Fl_Group {} {
label {BandWidth Envelope}
xywh {0 0 210 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 11 align 17
} {
Fl_Dial e4aval {
label {A.val}
callback {env->PA_val=(int)o->value();
freeedit->redraw();}
tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_val);}
class WidgetPDial
}
Fl_Dial e4adt {
label {A.dt}
callback {env->PA_dt=(int)o->value();
freeedit->redraw();}
tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PA_dt);}
class WidgetPDial
}
Fl_Dial e4rval {
label {R.val}
callback {env->PR_val=(int)o->value();
freeedit->redraw();}
tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_val);}
class WidgetPDial
}
Fl_Dial e4rdt {
label {R.dt}
callback {env->PR_dt=(int)o->value();
freeedit->redraw();}
tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->PR_dt);}
class WidgetPDial
}
Fl_Dial e4envstretch {
label Stretch
callback {env->Penvstretch=(int)o->value();}
tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(env->Penvstretch);}
class WidgetPDial
}
Fl_Check_Button e4forcedrelease {
label frcR
callback {env->Pforcedrelease=(int)o->value();}
tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 11 align 6
code0 {o->value(env->Pforcedrelease);}
}
Fl_Button {} {
label C
callback {presetsui->copy(env);}
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(env,this);}
xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
}
Fl_Button {} {
label E
callback {freemodeeditwindow->show();}
xywh {190 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10
}
}
}
Function {make_free_window()} {} {
Fl_Window envfree {
xywh {373 413 205 70} type Double color 50 labelfont 1 hide resizable
class Fl_Group
} {
Fl_Group envfreegroup {
label {Amplitude Envelope}
xywh {0 0 205 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 11 align 17 resizable
} {
Fl_Box freeeditsmall {
label Envelope
callback {envfree->redraw();}
xywh {5 20 195 45} box FLAT_BOX color 0 resizable
code0 {o->init(env);}
class EnvelopeFreeEdit
}
Fl_Button {} {
label E
callback {freemodeeditwindow->show();}
xywh {185 5 15 15} box PLASTIC_UP_BOX labelfont 1 labelsize 10
}
Fl_Button {} {
label C
callback {presetsui->copy(env);}
xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(env,this);}
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
}
}
}
}
Function {init(EnvelopeParams *env_)} {} {
code {env=env_;
make_ADSR_window();
make_ASR_window();
make_ADSRfilter_window();
make_ASRbw_window();
make_free_window();
make_freemode_edit_window();
envwindow=NULL;
if (env->Envmode==3) envfreegroup->label("Frequency Envelope");
if (env->Envmode==4) envfreegroup->label("Filter Envelope");
if (env->Envmode==5) envfreegroup->label("Bandwidth Envelope");
freemodeeditwindow->label(this->label());
freeeditsmall->setpair(freeedit);
freeedit->setpair(freeeditsmall);
refresh();} {}
}
Function {reinit()} {} {
code {if (env->Pfreemode!=0){
int answer=fl_ask("Disable the free mode of the Envelope?");
if (env->Pfreemode!=0) freemodebutton->value(1);
else freemodebutton->value(0);
if (answer==0) return;
};
if (env->Pfreemode==0) env->Pfreemode=1;
else env->Pfreemode=0;
hide();
int winx=freemodeeditwindow->x();
int winy=freemodeeditwindow->y();
freemodeeditwindow->hide();
envwindow->hide();
Fl_Group *par=envwindow->parent();
par->hide();
refresh();
envwindow->show();
par->redraw();
par->show();
show();
freemodeeditwindow->position(winx,winy);
freemodeeditwindow->show();
if (env->Pfreemode!=0) {
freemodebutton->value(1);
addpoint->show();
deletepoint->show();
forcedreleasecheck->show();
}else{
freemodebutton->value(0);
addpoint->hide();
deletepoint->hide();
forcedreleasecheck->hide();
};} {selected
}
}
Function {refresh()} {} {
code {freemodebutton->value(env->Pfreemode);
sustaincounter->value(env->Penvsustain);
if (env->Pfreemode==0) sustaincounter->hide();
else sustaincounter->show();
sustaincounter->maximum(env->Penvpoints-2);
envstretchdial->value(env->Penvstretch);
if (env->Pfreemode==0) envstretchdial->hide();
else envstretchdial->show();
linearenvelopecheck->value(env->Plinearenvelope);
if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide();
else linearenvelopecheck->show();
forcedreleasecheck->value(env->Pforcedrelease);
if (env->Pfreemode==0) forcedreleasecheck->hide();
freeedit->redraw();
if (env->Pfreemode==0){
switch(env->Envmode){
case(1):
case(2):
e1adt->value(env->PA_dt);
e1ddt->value(env->PD_dt);
e1sval->value(env->PS_val);
e1rdt->value(env->PR_dt);
e1envstretch->value(env->Penvstretch);
e1linearenvelope->value(env->Plinearenvelope);
e1forcedrelease->value(env->Pforcedrelease);
break;
case(3):
e2aval->value(env->PA_val);
e2adt->value(env->PA_dt);
e2rdt->value(env->PR_dt);
e2rval->value(env->PR_val);
e2envstretch->value(env->Penvstretch);
e2forcedrelease->value(env->Pforcedrelease);
break;
case(4):
e3aval->value(env->PA_val);
e3adt->value(env->PA_dt);
e3dval->value(env->PD_val);
e3ddt->value(env->PD_dt);
e3rdt->value(env->PR_dt);
e3rval->value(env->PR_val);
e3envstretch->value(env->Penvstretch);
e3forcedrelease->value(env->Pforcedrelease);
break;
case(5):
e4aval->value(env->PA_val);
e4adt->value(env->PA_dt);
e4rdt->value(env->PR_dt);
e4rval->value(env->PR_val);
e4envstretch->value(env->Penvstretch);
e4forcedrelease->value(env->Pforcedrelease);
break;
default:
break;
};
}else{
envfree->redraw();
};
envADSR->hide();
envASR->hide();
envADSRfilter->hide();
envASRbw->hide();
envfree->hide();
if (env->Pfreemode==0){
switch(env->Envmode){
case(1):
case(2):
envwindow=envADSR;
break;
case(3):
envwindow=envASR;
break;
case(4):
envwindow=envADSRfilter;
break;
case(5):
envwindow=envASRbw;
break;
default:
break;
};
}else{
envwindow=envfree;
};
envwindow->resize(this->x(),this->y(),this->w(),this->h());
envwindow->show();} {}
}
decl {EnvelopeParams *env;} {}
decl {Fl_Group *envwindow;} {}
}